Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add node menu refactoring and some new features #4703

Merged
merged 17 commits into from
Oct 24, 2022
Merged

Add node menu refactoring and some new features #4703

merged 17 commits into from
Oct 24, 2022

Conversation

Durman
Copy link
Collaborator

@Durman Durman commented Oct 11, 2022

Addressed problem description

New features:

  • New yaml format for main add node menu config file
  • Generating categories from the config files
  • Showing dependent nodes in menus
    image

Fixes #4700
Closes #3410

Preflight checklist

  • Code changes complete.
  • Code documentation complete.
  • Manual testing done.
  • Ready for merge.

@portnov
Copy link
Collaborator

portnov commented Oct 11, 2022

So python-yaml is now a required dependency for sverchok? Can we work without it?

@Durman
Copy link
Collaborator Author

Durman commented Oct 11, 2022

No need for dependencies. I made primitive parser for the file.

utils/yaml_parser.py Outdated Show resolved Hide resolved
@Durman
Copy link
Collaborator Author

Durman commented Oct 17, 2022

@vicdoval @Moult @mostaphaRoudsari @wassimj

After the PR the API of adding new categories to Sverchok's Add Node menu will be changed. Also it can lead to some problems in imports. It will be possible to add new categories in this way:

import sverchok.ui.nodeview_space_menu as sm
sm.add_node_menu.append_from_config(config)

def register():
    sm.add_node_menu.register()

The format of config structure -

[option, option, ..., menu item, menu item, ...]

Menu item can be one of next elements:

  • '---' - String of a dotted line to define separator.
  • 'SomeNode' - String of node bl_idname to define Add Node operator.
  • {'Sub category name': [option, menu_item, ...]} - Dictionary of
    a subcategory.
  • {'Operator name': [option, ...]} - Dictionary of a custom opeartor
    to call. Options for operator call are not supported currently.
  • {'Menu name': [option, ...]} - Custom menu to show.

Options have such format - {'option_name': value}. They can be added
to sub categories, operators and custom menus.

Categories can have next options:

  • {'icon_name': 'SOME_ICON'} - Value can be a string of standard Blender
    icons or Sverchok icon.

  • {'extra_menu': 'menu_name'} - Values is a name of one of extra menus.
    Possible values:

    • "BasicDataPartialMenu"
    • "MeshPartialMenu"
    • "AdvancedObjectsPartialMenu"
    • "ConnectionPartialMenu"
    • "UiToolsPartialMenu"

Operators options:

  • {"icon_name": "SOME_ICON"} - Icon to show in the menu.
  • {"operator": "operator id name"} - bl_idname of operator to call.

Custom menus options:

  • {"icon_name": "SOME_CION"} - Icon to show in menu.
  • {"custom_menu": "menu id name"} - bl_idname of menu to show.

The example of format can be found in the sverchok/index.yaml file (of current branch).

@Durman Durman marked this pull request as ready for review October 17, 2022 07:30
@Durman Durman merged commit c9f4700 into master Oct 24, 2022
@Durman Durman deleted the add_node_menu branch October 24, 2022 04:48
@portnov
Copy link
Collaborator

portnov commented Oct 24, 2022

@Durman

  1. IMHO these parameters
    Screenshot_20221024_115750
    should be in settings. In toolbar they just consume screen space.

@wassimj
Copy link

wassimj commented Oct 24, 2022

Two questions:

  1. Will the previous release (1.0) still be available for a while? I need to find time to understand and implement the needed changes to the Toplogic menu. Anyone willing to volunteer to do a PR on TopologicSverchok is much appreciated :) http://github.com/wassimj/TopologicSverchok
  2. Does this release solve the issue of re-running a parent node if a new connection is made to a new child node? This is slowing execution big time as everytime I need the output for a second or third node, it re-runs potentially a very slow node rather than re-use the output already generated.

@portnov
Copy link
Collaborator

portnov commented Oct 24, 2022

  1. Also, can we have spacers in toolbar in the same places where we have them in menu? They are used to split long menu in smaller logical groups, it is useful in toolbar too.

@portnov
Copy link
Collaborator

portnov commented Oct 24, 2022

  1. Toolbar tooltips look like "Add SV node: description". IMHO 1) "Add SV node" phrase is not needed; 2) first line of tooltip should be the title of the node, because it is not visible anywhere in "icons only" mode.

@Durman
Copy link
Collaborator Author

Durman commented Oct 24, 2022

should be in settings. In toolbar they just consume screen space.

I guess add-on settings should obtain properties which should be set once after add-on installation. It seemed to me that at least showing only icons property is useful to switch on/off depending on the filter output.

I will have a look at spaces and content of the tooltips.

@wassimj
It's not a release. This PR has description in the first post. Last release (1.1) will work fine with all Sverchok's extensions.

Durman added a commit that referenced this pull request Oct 24, 2022
@Durman
Copy link
Collaborator Author

Durman commented Oct 24, 2022

@portnov a74063a

@wassimj
Copy link

wassimj commented Dec 19, 2022

I kindly need help making topologic compatible with sverchok 1.2. The current init file is at (https://github.com/wassimj/TopologicSverchok/blob/main/__init__.py). Would someone from the sverchok team be willing to suggest how to edit it with examples so it does not break the way it imports 3rd party libraries? Thank you.

@Durman
Copy link
Collaborator Author

Durman commented Dec 20, 2022

@wassimj I will have a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tooltips of Add node operator in Blender 3.3 Presenting nodes with dependencies in menu
3 participants